package com.eudon.user.exception;

import com.eudon.user.enums.RespCode;
import lombok.Getter;

/**
 * @author eudon
 * @description 自定义异常
 * @date 2025/9/8
 * @email syd19970616@gmail.com
 * @address <a href="https://gitee.com/eudon">Gitee</a>
 */
@Getter
public class BusinessException extends RuntimeException {

    /**
     * 错误码
     */
    private final int code;
    private final String msg;

    public BusinessException(int code, String message) {
        super(message);
        this.code = code;
        this.msg = message;
    }

    public BusinessException(RespCode errorCode) {
        super(errorCode.getDesc());
        this.code = errorCode.getCode();
        this.msg = errorCode.getDesc();
    }

}

